<template>
  <div>
    <div class="container">
      <!-- 导航 -->
      <div class="nav">
        <h1 @click="$router.go(-1)">
          <a><i></i></a><span>{{ book_name }}</span>
        </h1>
        <div class="img">
          <a><img src="../assets/img/search_black.gif" alt="" /></a>
          <a><img src="../assets/img/bar.gif" alt="" /></a>
        </div>
      </div>
      <!-- 书籍详情 -->
      <div class="book-layout">
        <div class="img">
          <img :src="book_img" alt="" />
        </div>
        <div class="book-cell">
          <h2>{{ book_name }}</h2>
          <div class="author">
            <span>{{ book_author }}</span>
            <span>大神</span>
          </div>
          <p class="one">玄幻 / 异世大陆</p>
          <p class="two">{{ book_wordage }} | 连载</p>
        </div>
      </div>
      <!-- 书籍简介 -->
      <div class="book_info">
        <p>
          {{ book_info }}
        </p>
      </div>
      <!-- 目录 -->
      <div class="catalogue">
        <div class="category-item">
          <router-link tag="a" to="/catalogue">目录</router-link>
        </div>
        <div class="category-item">
          <a>最新章节 第601章：预知了个寂寞（月票加更+8.5</a>
          <span>2022-10-09</span>
        </div>
        <div class="category-item">
          <a>第600章：新超脱之源给谁</a>
          <span>2022-10-08</span>
        </div>
        <div class="category-item">
          <a>不科学御兽 第599章：一星十超神（月票加更+7.5）在线阅读</a>
          <span>2022-10-07</span>
        </div>
      </div>
      <!-- 背景过渡 -->
      <div class="bg"></div>
      <!-- 荣誉 -->
      <div class="honor">
        <div class="honor_l">
          <h3>荣誉动态</h3>
          <div class="honor_m">获得了男频月票榜(2022年09月)第二名</div>
        </div>
        <div class="honor_r">
          <p>荣誉殿堂</p>
          <div class="img">
            <img src="../assets/img/arrow_xiaoyu.gif" alt="" />
          </div>
        </div>
      </div>
      <!-- 荣誉照片 -->
      <div class="book-content">
        <div class="item">
          <img
            src="https://qidian.gtimg.com/qdm/img/badges/yp_s2_gg_2022.png"
            alt=""
          />
        </div>
        <div class="item">
          <img
            src="https://qidian.gtimg.com/qdm/img/badges/rongyao_4_v3.png"
            alt=""
          />
        </div>
        <div class="item">
          <img
            src="https://qidian.gtimg.com/qdm/img/badges/yp_s1_gg_2022.png"
            alt=""
          />
        </div>
        <div class="item">
          <img
            src="https://qidian.gtimg.com/qdm/img/badges/yp_s4_gg_2021.png"
            alt=""
          />
        </div>
      </div>
      <!-- 月票 -->
      <div class="ticket">
        <div class="ticket_item">
          <div class="img">
            <img src="../assets/img/yuepiao.gif" alt="" />
          </div>
          <h5>投月票</h5>
          <p>106626票·第4位</p>
        </div>
        <div class="ticket_item">
          <div class="img">
            <img src="../assets/img/yuepiao.gif" alt="" />
          </div>
          <h5>投月票</h5>
          <p>106626票·第4位</p>
        </div>
        <div class="ticket_item">
          <div class="img">
            <img src="../assets/img/yuepiao.gif" alt="" />
          </div>
          <h5>投月票</h5>
          <p>106626票·第4位</p>
        </div>
      </div>
      <!-- 世界观 -->
      <div class="btn-group">
        <div class="item con">世界观</div>
        <div class="item">角色</div>
        <div class="item">大事件</div>
      </div>
      <!-- 书友榜 -->
      <div class="bookfriends">
        <p>书友榜</p>
        <div class="bookfriends_info">
          <p>537.76万</p>
          <img src="../assets/img/arrow_xiaoyu.gif" alt="" />
        </div>
      </div>

      <div class="book-fans-cell">
        <div class="item">
          <div class="img_one">
            <img src="../assets/img/huangg.gif" alt="" />
          </div>
          <div class="img_two">
            <img src="../assets/img/toux.jpg" alt="" />
          </div>
          <p>薇拉安利迦南</p>
        </div>
        <div class="item">
          <div class="img_one">
            <img src="../assets/img/huangg.gif" alt="" />
          </div>
          <div class="img_two">
            <img src="../assets/img/toux.jpg" alt="" />
          </div>
          <p>薇拉安利迦南</p>
        </div>
        <div class="item">
          <div class="img_one">
            <img src="../assets/img/huangg.gif" alt="" />
          </div>
          <div class="img_two">
            <img src="../assets/img/toux.jpg" alt="" />
          </div>
          <p>薇拉安利迦南</p>
        </div>
        <div class="item">
          <div class="img_one">
            <img src="../assets/img/huangg.gif" alt="" />
          </div>
          <div class="img_two">
            <img src="../assets/img/wo.png" alt="" />
          </div>
          <p>已登录</p>
        </div>
      </div>

      <!-- 本书作者 -->
      <div class="bookfriends">
        <p>本书作者</p>
      </div>
      <div class="book_author">
        <div class="img">
          <img src="../assets/img/bkx.jpg" alt="" />
          <p class="dashen">大神</p>
        </div>
        <div class="book-cell">
          <h4>轻泉流响</h4>
          <p>阅文集团大神作家，2021年网络文学榜样作家十二天王之一。</p>
        </div>
      </div>

      <!-- 相关标签 -->
      <div class="bookfriends">
        <p>相关标签</p>
      </div>
      <div class="search-tags">
        <div class="item">召唤流</div>
        <div class="item">召唤流</div>
        <div class="item">召唤流</div>
      </div>

      <!-- 同类热推 -->
      <div class="weekly-hot">
        <h4>同类热推</h4>
        <ul>
          <li>
            <a href="">女帝的神级星卡师最新章节</a>
          </li>
          <li>
            <a href="">美漫第一仙最新章节</a>
          </li>
          <li>
            <a href="">玄幻：我的功法修炼能快进最新章节</a>
          </li>
          <li>
            <a href="">一人之力在线阅读</a>
          </li>
          <li>
            <a href="">我有一个变异胃小说</a>
          </li>
          <li>
            <a href="">我有一个变异胃小说</a>
          </li>
        </ul>
      </div>

      <!-- 小说内容
      <div class="read-section">
        <div class="read-comment-total"></div>
        <div class="read-title">
          <p>第一章：御兽时代</p>
        </div>
        <div class="read-content">
          <p>有的人死了，但没有完全死……</p>
          <p>无尽的昏迷过后，时宇猛地从床上起身。</p>
          <p>他大口的呼吸起新鲜的空气，胸口一颤一颤。</p>
          <p>迷茫、不解，各种情绪涌上心头。</p>
          <p>随后，时宇下意识观察四周，然后更茫然了。</p>
          <p>一个单人宿舍？</p>
          <p>就算他成功得到救援，现在也应该在病房才对。</p>
          <p>就算他成功得到救援，现在也应该在病房才对。</p>
          <p>就算他成功得到救援，现在也应该在病房才对。</p>
          <p>就算他成功得到救援，现在也应该在病房才对。</p>
        </div>
      </div> -->

      <!-- 固定 -->
      <div class="footer-section">
        <router-link tag="div" :to="'/read?id=' + '1101'" class="left"
          >开始阅读</router-link
        >
        <div class="right" type="primary" @click.stop="Dialog">
          <p>喜欢</p>
          <p>加入书架</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getbook_dataData } from "../api/home.js";
export default {
  data() {
    return {
      read_id: this.$route.query.id,
      book_name: "不科学御兽",
      book_img: "https://bookcover.yuewen.com/qdbimg/349573/1029006481/150",
      book_author: "轻泉流响",
      book_info:
        "这是一个以御兽为主流的异世界。动物，植物，元素，死灵，机械……九尾炎狐，生命古树，雷云精灵，骷髅君主，机械舰娘乃至孕育出灵的古董刀剑皆可作为宠兽，而契约、培养，御使它们的人类，则被统称为御兽师！神话学者兼考古学家时宇穿越而来，为了探寻空白的历史与失落的神话，他选择踏上了一条极为不科学的御兽之路…",
      book_wordage: "352.45万字",
    };
  },
  methods: {
    get_book() {
      if (this.$route.query.id) {
        getbook_dataData().then((data) => {
          let index = data.data.findIndex((item) => item.id == this.read_id);
          // console.log(data.data[index]);
          this.book_name = data.data[index].name;
          this.book_img = data.data[index].img;
          this.book_author = data.data[index].author;
          this.book_info = data.data[index].brief;
          this.book_wordage = data.data[index].wordage;
        });
      }
    },
    jump() {
      this.$router.push({
        path: "/bookshif",
        query: { user: this.$route.query.id },
      });
    },
    Dialog() {
      this.$dialog
        .confirm({
          title: "提醒",
          message: "确认加入书架吗？",
        })
        .then(() => {
          this.$router.push({
            path: "/bookshif",
            query: { user: this.$route.query.id },
          });
        })
        .catch(() => {
          console.log("取消");
        });
    },
  },
  created() {
    this.get_book();
    console.log(this.$route.query.id);
  },
};
</script>

<style lang="scss" scoped>
/* 导航 */
.nav {
  display: flex;
  padding: 9px 12px;
  justify-content: space-between;
  background-color: #fff;
  h1 {
    height: 26px;
    line-height: 26px;
    font-size: 18px;
    color: #ee2737;
    font-weight: bold;
    display: block;
    display: flex;
    span {
      font-size: 14px;
      color: #33373d;
      font-weight: normal;
      margin-left: 16px;
      margin-top: 2px;
    }
    i {
      display: block;
      width: 9px;
      height: 18px;
      background: url("../assets/img/arrow_da.gif") center center no-repeat;
      margin-top: 5px;
    }
  }
  .sex {
    display: flex;
    height: 24px;
    line-height: 24px;
    border: 1px solid #ed424b;
    p {
      &:nth-child(1) {
        padding: 0 12px;
        background-color: #ed424b;
        font-size: 12px;
        color: #fff;
      }
      &:nth-child(2) {
        padding: 0 12px;
        background-color: #fff;
        font-size: 12px;
        color: #ed424b;
      }
    }
  }
  .img {
    display: flex;
    img {
      width: 16px;
      height: 16px;
      padding-top: 6px;
    }
    a {
      &:nth-child(1) {
        img {
          margin-right: 20px;
        }
      }
    }
  }
}
/* 书籍详情 */
.book-layout {
  padding: 15px;
  display: flex;
  border-bottom: 1px solid #f9fafc;
  .book-cell {
    margin-left: 12px;
    h2 {
      height: 36px;
      line-height: 36px;
      font-size: 16px;
      color: #33373d;
      font-weight: bold;
    }
    .author {
      height: 28px;
      line-height: 28px;
      span {
        &:nth-child(1) {
          font-size: 13px;
          color: #33373d;
        }
        &:nth-child(2) {
          margin-left: 3px;
          font-size: 12px;
          color: #fff;
          background-color: #ee2737;
        }
      }
    }
    .one {
      height: 20px;
      line-height: 20px;
      color: #33373d;
      font-size: 12px;
    }
    .two {
      height: 20px;
      line-height: 20px;
      color: #33373d;
      font-size: 12px;
    }
  }
}

.book-layout {
  .img {
    img {
      width: 84px;
      height: 112px;
    }
  }
}

/* 书籍简介 */
.book_info {
  padding: 15px;
  padding-left: 0;
  margin-left: 15px;
  height: 72px;
  display: -webkit-box;
  word-break: break-all;
  text-overflow: ellipsis;
  overflow: hidden;
  border-bottom: 1px solid #f9fafc;
  p {
    line-height: 24px;
    word-break: break-all;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 13px;
    color: #33373d;
  }
}
/* 目录 */
.catalogue {
  font-size: 12px;
  padding: 0 15px;
}
.category-item {
  display: flex;
  justify-content: space-between;
  height: 26px;
  line-height: 26px;
  a {
    flex: 4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    color: #191919;
  }
  span {
    flex: 2;
    display: block;
    text-align: right;
    font-size: 13px;
    color: #191919;
  }
}
/* 荣誉 */
.honor {
  font-size: 13px;
  padding: 15px;
  padding-left: 0;
  margin-left: 15px;
  display: flex;
  height: 18px;
  line-height: 18px;
  justify-content: space-between;
  border-bottom: 1px solid #cccccc;
  .honor_r {
    display: flex;
    width: 40%;
    justify-content: end;
    color: #969ba3;
    .img {
      margin: auto 0;
      margin-left: 7px;
      img {
        width: 8px;
        height: 15px;
      }
    }
  }
}
.honor_l {
  display: flex;
  h3 {
    width: 44%;
  }
}
.honor_m {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-indent: 4px;
  color: #969ba3;
}
/* 荣誉照片 */
.book-content {
  display: flex;
  flex-wrap: wrap;
  .item {
    width: 25%;
    img {
      width: 60px;
      height: 60px;
      padding: 16px 12px;
      margin: 0 auto;
    }
  }
}
/* 月票 */
.ticket {
  margin-top: 22px;
  display: flex;
}
.ticket_item {
  width: 33.3%;
  text-align: center;
  .img {
    img {
      width: 34px;
      height: 28px;
      margin: 0 auto;
    }
  }
  h5 {
    font-size: 12px;
    color: #33373d;
    margin-top: 10px;
  }
  p {
    font-size: 12px;
    color: #969ba3;
    margin-top: 5px;
  }
}
/* 世界观 */
.btn-group {
  display: flex;
  padding: 15px;
  margin-top: 23px;
  justify-content: center;
  .item {
    font-size: 13px;
    height: 28px;
    line-height: 28px;
    padding: 0 32px;
    border-radius: 14px;
    color: #808080;
    background-color: #f5f5f5;
    margin-right: 6px;
    &.con {
      background-color: #ffe5e7;
      color: #e5353e;
    }
  }
}
/* 时代背景 */
.bg {
  padding: 0 15px;
  h4 {
    font-weight: bold;
    font-size: 16px;
    height: 27px;
    line-height: 27px;
  }
  p {
    line-height: 22px;
    font-size: 13px;
    color: #33373d;
  }
}
/* 书友榜 */
.bookfriends {
  margin-left: 15px;
  padding-right: 15px;
  padding-bottom: 15px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #f5f5f6;
  margin-top: 40px;
  & > p {
    font-size: 16px;
    color: #33373d;
    font-weight: bold;
  }
  .bookfriends_info {
    display: flex;
    p {
      font-size: 13px;
      color: #969ba3;
    }
    img {
      width: 20px;
      height: 15px;
      margin: auto 0;
    }
  }
}
.book-fans-cell {
  padding: 15px;
  padding-left: 0;
  padding-top: 0;
  margin-left: 15px;
  display: flex;
  font-size: 13px;
  color: #33373d;
  .item {
    text-align: center;
    width: 25%;
    padding-top: 15px;
    .img_one {
      img {
        width: 17px;
        height: 13px;
        margin: 0 auto;
      }
    }
    .img_two {
      margin-top: 2px;
      margin-bottom: 9px;
      img {
        width: 42px;
        height: 42px;
        margin: 0 auto;
      }
    }
    &:nth-child(3) {
      border-right: 2px solid #f9fafa;
    }
  }
}
/* 本书作者 */
.book_author {
  display: flex;
  margin-top: 18px;
  padding: 0 15px;
  .img {
    position: relative;
    img {
      width: 48px;
      height: 48px;
      border-radius: 50%;
    }
    & > p {
      position: absolute;
      font-size: 12px;
      color: #fff;
      bottom: 24px;
      left: 0;
      right: 0;
      margin: auto;
      background-color: #b3a7ff;
      width: 38px;
      height: 14px;
      text-align: center;
      line-height: 14px;
      border-radius: 8px;
      &.dashen {
        background-color: #ed424b;
      }
    }
  }
}
.book-cell {
  margin-left: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid #f1f2f3;
  padding-bottom: 22px;
  h4 {
    font-size: 16px;
    color: #33373d;
    font-weight: bold;
  }
  p {
    width: 100%;
    font-size: 14px;
    color: #969ba3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 8px;
  }
}
/* 相关标签 */
.search-tags {
  padding: 15px;
  padding-left: 0;
  margin-left: 15px;
  display: flex;
  .item {
    font-size: 13px;
    height: 28px;
    line-height: 28px;
    padding: 0 32px;
    border-radius: 14px;
    color: #808080;
    background-color: #f5f5f5;
    margin-right: 6px;
  }
}
/* 同类热推 */
.weekly-hot {
  padding: 15px;
  padding-left: 0;
  margin-left: 15px;
  padding-bottom: 63px;
  ul {
    display: flex;
    flex-wrap: wrap;
    li {
      height: 25px;
      line-height: 25px;
      padding: 0 7px;
      font-size: 12px;
      border: 1px solid #989898;
      border-radius: 12px;
      margin-top: 11px;
      margin-right: 12px;
      a {
        color: #808080;
      }
    }
  }
}
/* 小说内容 */
.read-section {
  background-color: #f5f5f5;
  position: relative;
}
.read-title {
  padding: 38px 15px;
  font-size: 30px;
  color: #33373d;
  font-weight: bold;
}
.read-content {
  line-height: 35px;
  p {
    text-indent: 2em;
    padding: 0 15px;
    font-size: 18px;
    line-height: 35px;
    margin: 0.8em 0;
  }
}
/* 固定 */
.footer-section {
  position: fixed;
  bottom: 0;
  padding: 0 15px;
  height: 62px;
  background-color: #ffffff;
  width: 100%;
  display: flex;
  justify-content: space-between;
  .left {
    height: 48px;
    line-height: 48px;
    font-size: 16px;
    color: #e5353e;
    background-color: #ffe5e7;
    border-radius: 20px;
    padding: 0 22px;
    margin: auto 0;
  }
  .right {
    width: 218px;
    height: 48px;
    background-color: #e5353e;
    color: #ffff;
    margin: auto 0;
    text-align: center;
    margin-right: 30px;
    border-radius: 20px;
    p {
      &:nth-child(1) {
        font-size: 15px;
        margin-top: 6px;
      }
      &:nth-child(2) {
        font-size: 12px;
      }
    }
  }
}
</style>
